package com.vue3.blog.web;

import com.vue3.blog.common.resp.Result;
import com.vue3.blog.service.IFileUploadService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author Mr.小朱同学
 * @version 1.0.0
 * @date 2025/6/11 12:52
 * @description 文件上传
 */
@RequestMapping("/api/upload")
@RestController
public class FileUploadController {
    @Resource
    private IFileUploadService fileUploadService;

    @PostMapping("/image")
    public Result<String> uploadImage(@RequestParam("file") MultipartFile file) {
        return Result.success("上传成功", fileUploadService.uploadImage(file));
    }

}